<script language="javascript">
var showmua=false;
function showmenu(a,id,obj)
{
	showmua=true;
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	top_offset = top_offset + 15;
	$('#hiddenpid').val(id);
	var e=$('#'+a);
	e.css("top",top_offset);
	e.css("left",left_offset-28);
	if (e.css("display")=="none"){e.fadeIn('fast')};
	var m=$('#Layer1');
	m.css("top",top_offset-18);
	m.css("left",left_offset-28);
	if (m.css("display")=="none"){m.fadeIn('fast')};
}
function showmenu2(a)
{
	showmua=true;
	var e=$('#'+a);
	if (e.css("display")=="none"){e.fadeIn('fast')};
	var m=$('#Layer1');
	if (m.css("display")=="none"){m.fadeIn('fast')};
}
function hidemenu(a){
	showmua=false;
	setTimeout('hid("'+a+'")',100);
}
function hid(a){
	var e=$('#'+a)
	if (e.css("display")=="block" && showmua==false){e.fadeOut('fast')}
	var m=$('#Layer1')
	if (m.css("display")=="block" && showmua==false){m.fadeOut('fast')}
	showmua=true;
}
</script>
<form action="product.manage.php" method="get" name="form_p_list1" id="form_p_list1"  onsubmit="return ajax_list1();">
	<input type="hidden" name="action" value="ajax_list" />
    <input name="searchcate" type="hidden" id="searchcate" value="0" />
    <input type="hidden" name="curpage" value="1" />
    <input type="hidden" name="pcid" value="<tpl> $product_condition.pcid </tpl>" />
    <input type="hidden" name="searchtype" value="<tpl> $product_condition.searchtype|default:'1' </tpl>" />
    <input type="hidden" name="tf_charge" value="<tpl> $product_condition.tf_charge </tpl>" />
    <input type="hidden" name="autopub" value="<tpl> $product_condition.autopub </tpl>" />
    <input type="hidden" name="order" id="order" value="<tpl> $product_condition.order </tpl>" />
    <input type="hidden" name="sorttype" value="<tpl> $product_condition.sorttype </tpl>" />
	<input type="hidden" name="search_place" id="search_place" value="<tpl> $product_condition.search_place </tpl>" />
<table  class="from_table_only">
	<tr>
		<th class="td1"><tpl> $langSysType </tpl>：</th> <td colspan="3"><select name="c1" id="c1" style="WIDTH: 110px">
            <option value=""></option>
            <tpl> foreach item = parent from = $ProductCateArray </tpl>
            <option value="<tpl>$parent.id</tpl>||<tpl>$parent[5]</tpl>"><tpl>$parent.name</tpl></option>
            <tpl> /foreach </tpl>
          </select>
          <select name="c2" id="c2" style="WIDTH: 110px">
          </select>
          <select name="c3" id="c3" style="WIDTH: 110px">
          </select>
          <select name="c4" id="c4" style="WIDTH: 110px">
          </select>  
        </td>
	  </tr>
	   <tr>
		<th class="td1"><tpl> $langSysKeyWord </tpl>：</th>
		<td colspan="2"> <input type="text" size="20" value="" name="keyword" class="txtinput" /></td>
		
	  </tr>
	  <tr>
	  <th class="td1"><tpl> $langSysSaleMemberName </tpl>：</th>
		<td colspan="2"> <input name="shopname" size="20" value="" class="txtinput" /></td>
	  </tr>
	  <tr>
		<th class="td1"><tpl> $langSysSaleBound </tpl>　：</th><td> <input class="txtinput_short" size="6" name="price_min" value="" />
          <tpl> $langCYuan </tpl> <tpl> $langSysProductTo </tpl><input class="txtinput_short" size="6" name="price_max" value="" /><tpl> $langCYuan </tpl> 
		</td>
		
	  </tr>
	  <tr>
	  	<th class="td1"><tpl> $langSysBuyType </tpl>　：</th><td> <select name="sell_type" id="sell_type">
			  <option <tpl> if $product_condition.sell_type eq 'all' </tpl> selected="selected" <tpl> /if </tpl> value="all"><tpl> $langSysProductAll </tpl></option>
              <option <tpl> if $product_condition.sell_type eq '0' </tpl> selected="selected" <tpl> /if </tpl> value="0"><tpl> $langPauction </tpl></option>
			  <option <tpl> if $product_condition.sell_type eq '1' </tpl> selected="selected" <tpl> /if </tpl> value="1"><tpl> $langPfixprice </tpl></option>
			  <option <tpl> if $product_condition.sell_type eq '2' </tpl> selected="selected" <tpl> /if </tpl> value="2"><tpl> $langPcamel </tpl></option>
            </select>
		</td>
	  </tr>
	  <tr>
	  <tpl> if $sys_group_info.sys_group_area_id neq "" </tpl>
	  	<th class="td1"><tpl> $langSysPAreaSeach </tpl>　：</th><td colspan="2">
	  		<input type="hidden" name="p_area_id" id="p_area_id" />
			<select id="area_c1" class="searchformselect" name="area_c1" style="width: 120px">
				<option valus="" selected></option>
				<tpl> foreach item = parent from = $area_array </tpl>
				<option <tpl> if $sel_area[0].area_id eq $parent.area_id </tpl>selected="selected"<tpl> /if  </tpl> value="<tpl>$parent.area_id</tpl>||<tpl>$parent.is_parent</tpl>"><tpl> $parent.area_name </tpl></option>
			<tpl> /foreach </tpl>
			</select>
			<select class="searchformselect" id="area_c2" style="width: 120px" name="area_c2">
			</select>
			<select class="searchformselect" id="area_c3" style="width: 120px" name="area_c3">
			</select>
			<select class="searchformselect" id="area_c4" style="width: 120px" name="area_c4">
			</select>
	  	</td>
	<tpl> else </tpl>
	  	<th class="td1" style="display:none" colspan="2"></th>
	<tpl> /if </tpl>
	  </tr>
	   <tr style="background:none;">
		<th></th>
		<td><div style=" width:340px; text-align:right;">
		<span class="btn_left">
		<input name="submit3" value="<tpl> $langSysSeach </tpl>" type="submit" class="btn_submit"/>
		</span>
		</div></td>
		<td></td>	<td></td>
	  </tr>
</table>		
</form>
<script>
//搜索
function ajax_list1(){
	/* 取表单参数 */var queryString=$("#form_p_list1").formSerialize();
	$.ajax({
		url: "product.manage.php",
		data: queryString,
		type:'get',
		dataType:"html",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideMessage();
			$("#result_content").html(msg);
			hideLoading();
		}
	});
	return false;
}
	
function tonext(whos) {
	$(whos).change(
		function(){
			var valarray=$(this).val().split('||');	
			$('#category').val(valarray[0]);
			$('#searchcate').val(valarray[0]);
			if (valarray[1]=='1') {
				$(this).next().attr('disabled','true').html('<option value="" selected="selected"><tpl> $langCDataToLoading </tpl></option>');
				$.get('../member/own_productcate.php',{action:'list',id:valarray[0],random_number:Math.random()},function(data){
				DataArray = data.split("|||");var a='';for (var i = 0; i<DataArray.length-1; i++) {att=DataArray[i].split("||");id=att[0];cla=att[2];a+='<option value="'+id+'||'+cla+'">'+att[1]+((cla=='1')?' ->':'')+'</option>';};
				$(whos).next().removeAttr('disabled').html('<option value="" selected="selected"></option>'+a).nextAll().html('');
				tonext($(whos).next());
			})} else {$(whos).nextAll().html('').attr('disabled','true');
			};
	})
};

function area_tonext(whos) {
	$(whos).change(
		function(){
			var valarray=$(this).val().split('||');	
			$('#p_area_id').val(valarray[0]);
			if (valarray[1]=='1') {
				$(this).next().attr('disabled','true').html('<option value="" selected="selected"><tpl> $langCDataToLoading </tpl></option>');
				$.get(
					'../home/tohtml.php',
					{action:'get_area',id:valarray[0],random_number:Math.random()},
					function(data){
						DataArray = data.split("|||");
						var a='';
						for (var i = 0; i<DataArray.length-1; i++) {
							att=DataArray[i].split("||");
							id=att[0];
							cla=att[2];
							a+='<option value="'+id+'||'+cla+'">'+att[1]+((cla=='1')?' ->':'')+'</option>';
						}
						
					$(whos).next().removeAttr('disabled').html('<option value="" selected="selected"></option>'+a).nextAll().html('');
					area_tonext($(whos).next());
					}
				)
			} else {
				$(whos).nextAll().html('').attr('disabled','true');
			};
		}
	)
};
$().ready(function() {
	area_tonext('#area_c1');
	tonext('#c1');
});
</script>
<form action="product.manage.php" method="get" name="form_p_list" id="form_p_list"  onsubmit="return ajax_list();">
	<input type="hidden" name="action" value="<tpl> $product_condition.action </tpl>" />
    <input type="hidden" name="searchcate" id="searchcate" value="0" />
    <input type="hidden" name="curpage" value="1" />
    <input type="hidden" name="pcid" value="<tpl> $product_condition.pcid </tpl>" />
    <input type="hidden" name="searchtype" value="<tpl> $product_condition.searchtype|default:'1' </tpl>" />
    <input type="hidden" name="shopname" value="<tpl> $product_condition.shopname </tpl>" />
    <input type="hidden" name="tf_charge" value="<tpl> $product_condition.tf_charge </tpl>" />
    <input type="hidden" name="autopub" value="<tpl> $product_condition.autopub </tpl>" />
    <input type="hidden" name="order" id="order" value="<tpl> $product_condition.order </tpl>" />
    <input type="hidden" name="sorttype" value="<tpl> $product_condition.sorttype </tpl>" />
	<input type="hidden" name="search_place" id="search_place" value="<tpl> $product_condition.search_place </tpl>" />
	<input type="hidden" name="p_index" id="p_index" value="<tpl> $product_condition.p_index </tpl>" />
<table class="from_table2_one" style=" margin-top:10px; *margin-top:0px;">
	<thead>
	<tr class="area_ajax_list_title">
  		<th class="pd-left" width="70"><tpl> $langSysProductImage </tpl></th>
    	<th width="180"><tpl> $langSysProductName </tpl></th>
  		<th width="60"><tpl> $langSysProductSale </tpl></th>
    	<th width="60"><tpl> $langSysProductPrice </tpl></th>
    	<th width="60"><tpl> $langSysTranFee </tpl></th>
    
    	<th width="100"><tpl> $langSysPArea </tpl></th>
		<th width="150"><tpl> $langSysResidualTime </tpl></th>
		
    	<th width="50"><tpl> $langCOperation </tpl></th>
    </tr>
	</thead>
	<tpl> if $product_array[0].p_code neq '' </tpl>
		<tpl> section name=i loop=$product_array </tpl>
		<tr>
			<td width="70" >
			<tpl> if $product_array[i].html_url neq '' </tpl>
				<a href="<tpl> $product_array[i].html_url </tpl>" target="_blank">
			<tpl> else </tpl>
				<a href="<tpl> $site_url </tpl>/home/product.php?action=view&amp;pid=<tpl> $product_array[i].p_code </tpl>" target="_blank">
			<tpl> /if </tpl>
				<img src="<tpl> $site_url </tpl>/<tpl> $product_array[i].small_pic|default:'templates/default/images/noimgs.gif' </tpl>" alt="<tpl> $product_array[i].p_name </tpl>" border="0" style="vertical-align:middle; margin-left:10px;margin-right:10px; width:50px; height:50px" />
			</a>
		  </td>
			<td width="180" align="left">
			<tpl> if $product_array[i].html_url neq '' </tpl>
				<a href="<tpl> $product_array[i].html_url </tpl>" target="_blank">
			<tpl> else </tpl>
				<a href="<tpl> $site_url </tpl>/home/product.php?action=view&amp;pid=<tpl> $product_array[i].p_code </tpl>" target="_blank">
			<tpl> /if </tpl>
		  <tpl> $product_array[i].p_name </tpl></a></td>
			<td width="100" align="left"><a href="<tpl> $site_url </tpl>/store/index.php?userid=<tpl> $product_array[i].member_id </tpl>" target='_blank'>
		  <tpl> $product_array[i].shopmaster </tpl></a></td>
			<td width="100" align="left"><tpl> assign var='sell_type' value = $product_array[i].p_sell_type </tpl><tpl> $p_sell_type[$sell_type] </tpl><br/>
		  <tpl> $product_array[i].p_price </tpl></td>
		  <td width="100" align="left"><tpl> $product_array[i].p_tf_py </tpl></td>
	
		  <td width="80" align="left"><tpl> $product_array[i].area_name </tpl></td>
		  <td width="80" align="left"><tpl> $product_array[i].left_days </tpl><tpl> $langPday </tpl><tpl> $product_array[i].left_hours </tpl><tpl> $langPhour </tpl><tpl> $product_array[i].left_minutes </tpl><tpl> $langPminute </tpl></td>
			<td width="50" align="left"><a href="javascript:;" class="biankuang" id="aa<tpl> $product_array[i].p_code </tpl>" onmouseover="showmenu('mc','<tpl> $product_array[i].p_code </tpl>',this);" onmouseout="hidemenu('mc');">
		  <tpl> $langCOperation </tpl><img src="<tpl> $template_dir </tpl>/system_new/images/ico2.gif" border="0" style="vertical-align:middle; padding-left:2px;" /></a></td>
		</tr>
		<input type='hidden' id='hidden_p_auto_publish' value='<tpl> $product_array[i].p_auto_publish </tpl>' />
		<tpl> /section </tpl>
	
	<tpl> else  </tpl>
		<tr>
			<td colspan="9" align="center" valign="center"><tpl> $langCNull </tpl></td>
		</tr>
	<tpl> /if  </tpl>
</table>
<tpl> if $product_array[0].p_code neq '' </tpl>
<div class="table-5-bottom"><div class="btn_marginright"><tpl> $page_list </tpl></div></div>
<tpl> /if  </tpl>
</form>
<div id="ui_question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px; "><tpl> $langCConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div>

<div class="showmenu" id="mc" onmouseover="showmenu2('mc','<tpl> $product_array[i].p_code </tpl>');" onmouseout="hidemenu('mc');">
<ul>
<li><a href="javascript:;" id='editproduct'><tpl> $langSysProductEdit </tpl></a></li>
<li><a href="javascript:;" id='irregularitiesproduct'><tpl> $langSysProductInfractOperator </tpl></a></li>
<li><a href="javascript:;" id='underproduct'><tpl> $langSysProductdown </tpl></a></li>
<li><a href="javascript:;" id='delproduct'><tpl> $langSysDelProduct </tpl></a></li>
<li><a href="javascript:;" id='htmlproduct'><tpl> $langSysCreateStat </tpl></a></li>
</ul>
<input type='hidden' id='hiddenpid' value='' />

</div>
<div id="Layer1" onmouseover="showmenu2('mc','<tpl> $product_array[i].p_code </tpl>');" onmouseout="hidemenu('mc');"></div>
<script language="javascript">
var ui_question = $("#ui_question")[0];
//删除
function ui_del(str){
	hideMessage();
	$.blockUI(ui_question, { width: '275px' });
	$('#del_value').val(str);
}
$(function() {
	$('#yes').click(function() {
		$.ajax({
			url: "product.manage.php",
			data: 'action=del&chboxPid='+$('#del_value').val(),
			type:'post',
			dataType:"json",
			beforeSubmit:  showLoading(showText),
			success: function(msg){
				hideLoading();
				showMessage(msg.message,msg.type);
				if(msg.type == 1){
					ShowDiv	= 'result_content';
					getPageContent('product.manage.php?action=ajax_list&searchcate=<tpl> $product_condition.searchcate </tpl>&pcid=<tpl> $product_condition.pcid </tpl>&searchtype=<tpl> $product_condition.searchtype|default:'1' </tpl>&shopname=<tpl> $product_condition.shopname </tpl>&tf_charge=<tpl> $product_condition.tf_charge </tpl>&autopub=<tpl> $product_condition.autopub </tpl>&order=<tpl> $product_condition.order </tpl>&sorttype=<tpl> $product_condition.sorttype </tpl>&search_place=<tpl> $product_condition.search_place </tpl><tpl> if $product_array|@count neq 1 </tpl>&curpage=<tpl>$curpage</tpl><tpl> /if </tpl>');
				}
				$.unblockUI();
			}
		});
		return false;
	});
	$('#no').click($.unblockUI);
	
	$('#editproduct').click(function(){
		id = $('#hiddenpid').val();
		ajax_modi('action=modi&pid='+id);
	});
	$('#irregularitiesproduct').click(function(){
		id = $('#hiddenpid').val();
		ajax_url('action=irregularities&pid='+id);
	});
	$('#underproduct').click(function(){
		id = $('#hiddenpid').val();
		p_auto_publish = $('#hidden_p_auto_publish').val();
		ajax_url('action=under&chboxPid='+id+'&p_auto_publish='+p_auto_publish);
	});
	$('#delproduct').click(function(){
		id = $('#hiddenpid').val();
		ui_del(id);
	});
	$('#htmlproduct').click(function(){
		id = $('#hiddenpid').val();
		ajax_html('action=make_one_html&chboxPid='+id);
	});
});

function orderbyprice() {$("#order").val(2);ajax_list();};
function orderbylefttime() {$("#order").val(1);ajax_list();};

function ajax_list(){
	/* 取表单参数 */var queryString=$("#form_p_list").formSerialize();
	var order = $("#order").val();
	var search_place = $("#search_place").val();
	$.ajax({
		url: "product.manage.php",
		data: queryString+"&order="+order+"&search_place="+search_place,
		type:'post',
		dataType:"html",
		clearForm:true,
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			$("#result_content").html(msg);
			hideLoading();
		}
	});
	return false;
}

//ajax url跳转
function ajax_url(str){
	$.ajax({
		url: "product.manage.php",
		data: str,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('product.manage.php?action=ajax_list&searchcate=<tpl> $product_condition.searchcate </tpl>&pcid=<tpl> $product_condition.pcid </tpl>&searchtype=<tpl> $product_condition.searchtype|default:'1' </tpl>&shopname=<tpl> $product_condition.shopname </tpl>&tf_charge=<tpl> $product_condition.tf_charge </tpl>&autopub=<tpl> $product_condition.autopub </tpl>&order=<tpl> $product_condition.order </tpl>&sorttype=<tpl> $product_condition.sorttype </tpl>&search_place=<tpl> $product_condition.search_place </tpl>&curpage=<tpl> $curpage </tpl>');
			}
		}
	});
	return false;
}
//ajax 生成静态
function ajax_html(str){
	$.ajax({
		url: "product.html.php",
		data: str,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = 'result_content';
				getPageContent('product.manage.php?action=ajax_list&searchcate=<tpl> $product_condition.searchcate </tpl>&pcid=<tpl> $product_condition.pcid </tpl>&searchtype=<tpl> $product_condition.searchtype|default:'1' </tpl>&shopname=<tpl> $product_condition.shopname </tpl>&tf_charge=<tpl> $product_condition.tf_charge </tpl>&autopub=<tpl> $product_condition.autopub </tpl>&order=<tpl> $product_condition.order </tpl>&sorttype=<tpl> $product_condition.sorttype </tpl>&search_place=<tpl> $product_condition.search_place </tpl>&curpage=<tpl> $curpage </tpl>');
			}
		}
	});
	return false;
}
//编辑
function ajax_modi(str){
	ShowDiv = 'result_content';
	getPageContent('product.manage.php?'+str+'&searchcate=<tpl> $product_condition.searchcate </tpl>&pcid=<tpl> $product_condition.pcid </tpl>&searchtype=<tpl> $product_condition.searchtype|default:'1' </tpl>&shopname=<tpl> $product_condition.shopname </tpl>&tf_charge=<tpl> $product_condition.tf_charge </tpl>&autopub=<tpl> $product_condition.autopub </tpl>&order=<tpl> $product_condition.order </tpl>&sorttype=<tpl> $product_condition.sorttype </tpl>&search_place=<tpl> $product_condition.search_place </tpl>&curpage=<tpl> $curpage </tpl>');
}
</script>